/**
 * 
 */
package com.yst.metho.web.application.pointage;

import java.util.Calendar;
import java.util.Collection;

/**
 * @author perso
 * 
 */
public class PointageViewModel
{
	private Calendar mWeek;

	private boolean mIsWeekConsolidated = false;

	private Collection mActivities;

	private Collection mPointage;

	/**
	 * @param week
	 * @param activities
	 * @param pointage
	 */
	public PointageViewModel(Calendar week, Collection activities, Collection pointage, boolean isWeekConsolidated)
	{
		super();
		mWeek = week;
		mActivities = activities;
		mPointage = pointage;
		mIsWeekConsolidated = isWeekConsolidated;
	}

	/**
	 * @return the activities
	 */
	public Collection getActivities()
	{
		return mActivities;
	}

	/**
	 * @return the week
	 */
	public Calendar getWeek()
	{
		return (Calendar) mWeek.clone();
	}

	/**
	 * Retourne le lundi de la semaine courante.
	 * 
	 * @return
	 */
	public Calendar getMondayOfWeek()
	{
		Calendar cal;
		cal = getWeek();
		cal.add(Calendar.DAY_OF_MONTH, Calendar.MONDAY - cal.get(Calendar.DAY_OF_WEEK));
		return cal;
	}

	/**
	 * @return the pointage
	 */
	public Collection getPointage()
	{
		return mPointage;
	}

	/**
	 * retourne le numero de la semaine selectionnee.
	 * 
	 * @return
	 */
	public String getWeeknumber()
	{
		return Integer.toString(mWeek.get(Calendar.WEEK_OF_YEAR));
	}

	/**
	 * @return the isWeekConsolidated
	 */
	protected boolean isWeekConsolidated()
	{
		return mIsWeekConsolidated;
	}
}
